
use "RR_Construction.dta", clear



**** Appendix Figure A3: Relative Risk Example
*** Graph Risk for Each ID in Shivwitz Paiute Settlement
********************************************************************************
********************************************************************************


qui regress pc short if ID==1, noconst
local slope = _b[short]
su pc short
colorpalette #fafa6e #2a4858, ipolate(30, HCL) nograph
twoway (rspike zero pc short if ID==1, lcolor(none)) /// 
(function fitted = `slope' * x if ID==1, lcolor("`r(p23)'") lpattern(dash) lwidth(thick) range(0 .9)) /// 
(scatter pc short if ID==1, msize(5.3) msymbol(circle) mlabel(curtailmentPct_st0) mlabcolor(black%40) mlabsize(2.3) mcolor("`r(p20)'%40") mlcolor(none) mlabposition(0)) ///
, graphregion(margin(tiny)) plotregion(margin(medium)) xlabel(0 "0" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%" .7 "70%" .8 "80%" .9 "90%", labsize(small) labcolor(black) notick nogrid) xtitle("Reduction in Total Water Supply", size(med) color(black)) ylabel( 0 "0" .2 "20%" .4 "40%" .6 "60%" .8 "80%" 1 "100%", labsize(small) labcolor(black) notick nogrid) ytitle("Curtailment (%)", size(medlarge) color(black))  xsize(10) ysize(10) title("Bloomington ID", size(medlarge) color(black)) legend(ring(0) position(10) label(2 "m = .348") order(2)  size(small) bmargin(medlarge) stacked) saving(shortage1, replace)


qui regress pc short if ID==6, noconst
local slope = _b[short]
su pc short
colorpalette #fafa6e #2a4858, ipolate(30, HCL)
twoway (rspike zero pc short if ID==6, lcolor(none) lwidth(medium)) ///
(function fitted = `slope' * x if ID==6, lcolor("`r(p19)'") lpattern(dash) lwidth(thick) range(0 .9)) /// 
(scatter pc short if ID==6, msize(5.3) msymbol(circle) mlabel(curtailmentPct_st0) mlabcolor(black%40) mlabsize(2.3) mcolor("`r(p18)'%40") mlcolor(none) mlabposition(0)) ///
, graphregion(margin(tiny)) plotregion(margin(medium)) xlabel(0 "0" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%" .7 "70%" .8 "80%" .9 "90%", labsize(small) labcolor(black) notick nogrid) xtitle("Reduction in Total Water Supply", size(med) color(black)) ylabel( 0 "0" .2 "20%" .4 "40%" .6 "60%" .8 "80%" 1 "100%", labsize(small) labcolor(black) notick nogrid) ytitle("Curtailment (%)", size(medlarge) color(black))  xsize(10) ysize(10) legend(ring(0) position(10) label(2 "m = 0.559") order(2) size(small) bmargin(medlarge) stacked) saving(shortage2, replace) title("St. George Clara", size(medlarge) color(black))


qui regress pc short if ID==5, noconst
local slope = _b[short]
su pc short
colorpalette #fafa6e #2a4858, ipolate(30, HCL) nograph
twoway (rspike zero pc short if ID==5, lcolor(none) lwidth(medium)) ///
(function fitted = `slope' * x if ID==5, lcolor("`r(p16)'") lpattern(dash) lwidth(thick) range(0 .9)) /// 
(scatter pc short if ID==5, msize(5.3) msymbol(circle) mlabel(curtailmentPct_st0) mlabcolor(black%40) mlabsize(2.3) mcolor("`r(p15)'%40") mlcolor(none) mlabposition(0)) ///
, graphregion(margin(tiny)) plotregion(margin(medium)) xlabel(0 "0" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%" .7 "70%" .8 "80%" .9 "90%", labsize(small) labcolor(black) notick nogrid) xtitle("Reduction in Total Water Supply", size(med) color(black)) ylabel( 0 "0" .2 "20%" .4 "40%" .6 "60%" .8 "80%" 1 "100%", labsize(small) labcolor(black) notick nogrid) ytitle("Curtailment (%)", size(medlarge) color(black))  xsize(10) ysize(10) legend(ring(0) position(10) label(2 "m = 0.359") order(2)  size(small) bmargin(medlarge) stacked) saving(shortage3, replace) title("New Santa Clara", size(medlarge) color(black))


qui regress pc short if ID==2, noconst
local slope = _b[short]
su pc short
colorpalette #fafa6e #2a4858, ipolate(30, HCL) nograph
twoway (rspike zero pc short if ID==2, lcolor(none) lwidth(medium)) ///
(function fitted = `slope' * x if ID==2, lcolor("`r(p12)'") lpattern(dash) lwidth(thick) range(0 .9)) /// 
(scatter pc short if ID==2, msize(5.3) msymbol(circle) mlabel(curtailmentPct_st0) mlabcolor(black%40) mlabsize(2.3) mcolor("`r(p12)'%40") mlcolor(none) mlabposition(0)) ///
, graphregion(margin(tiny)) plotregion(margin(medium)) xlabel(0 "0" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%" .7 "70%" .8 "80%" .9 "90%", labsize(small) labcolor(black) notick nogrid) xtitle("Reduction in Total Water Supply", size(med) color(black)) ylabel( 0 "0" .2 "20%" .4 "40%" .6 "60%" .8 "80%" 1 "100%", labsize(small) labcolor(black) notick nogrid) ytitle("Curtailment (%)", size(medlarge) color(black))  xsize(10) ysize(10) legend(ring(0) position(10) label(2 "m = 0.954") order(2)  size(small) bmargin(medlarge) stacked) saving(shortage4, replace) title("Gunlock", size(medlarge) color(black))


qui regress pc short if ID==3, noconst
local slope = _b[short]
su pc short
colorpalette #fafa6e #2a4858, ipolate(30, HCL) nograph
twoway (rspike zero pc short if ID==3, lcolor(none) lwidth(medium)) ///
(function fitted = `slope' * x if ID==3, lcolor("`r(p8)'") lpattern(dash) lwidth(thick) range(0 .9)) /// 
(scatter pc short if ID==3, msize(5.3) msymbol(circle) mlabel(curtailmentPct_st0) mlabcolor(black%40) mlabsize(2.3) mcolor("`r(p9)'%40") mlcolor(none) mlabposition(0)) ///
, graphregion(margin(tiny)) plotregion(margin(medium)) xlabel(0 "0" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%" .7 "70%" .8 "80%" .9 "90%", labsize(small) labcolor(black) notick nogrid) xtitle("Reduction in Total Water Supply", size(med) color(black)) ylabel( 0 "0" .2 "20%" .4 "40%" .6 "60%" .8 "80%" 1 "100%", labsize(small) labcolor(black) notick nogrid) ytitle("Curtailment (%)", size(medlarge) color(black))  xsize(10) ysize(10) legend(ring(0) position(10) region(fcolor(none)) label(2 "m = 1.184") order(2) size(small) bmargin(medlarge) stacked) saving(shortage5, replace) title("Ivins", size(medlarge) color(black))


qui regress pc short if ID==4, noconst
local slope = _b[short]
su pc short
colorpalette #fafa6e #2a4858, ipolate(30, HCL) nograph
twoway (rspike zero pc short if ID==4, lcolor(none) lwidth(medium)) ///
(function fitted = `slope' * x if ID==4, lcolor("`r(p4)'") lpattern(dash) lwidth(medthick) range(0 .7)) /// 
(scatter pc short if ID==4, msize(5.3) msymbol(circle) mlabel(curtailmentPct_st0) mlabcolor(black%40) mlabsize(2.3) mcolor("`r(p6)'%40") mlcolor(none) mlabposition(0)) ///
, graphregion(margin(tiny)) plotregion(margin(medium)) xlabel(0 "0" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%" .7 "70%" .8 "80%" .9 "90%", labsize(small) labcolor(black) notick nogrid) xtitle("Reduction in Total Water Supply", size(med) color(black)) ylabel( 0 "0" .2 "20%" .4 "40%" .6 "60%" .8 "80%" 1 "100%", labsize(small) labcolor(black) notick nogrid) ytitle("Curtailment (%)", size(medlarge) color(black))  xsize(10) ysize(10) legend(ring(0) stacked position(11) bmargin(medlarge) label(2 "m = 1.502") order(2) size(small)) saving(shortage6, replace) title("Lower Gunlock", size(medlarge) color(black))


graph combine shortage1.gph shortage2.gph shortage3.gph shortage4.gph shortage5.gph shortage6.gph , xsize(20) ysize(11) col(3)
